package com.qjz.diancan.mapper;


import com.qjz.diancan.model.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zhu
 * @since 2024-02-14
 */
@Mapper
public interface CategoryMapper {

    @Select("select * from category order by `rank` asc")
    List<Category> selectAll();

    @Delete("delete from category where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into category(label,`rank`) values(#{label},#{rank})")
    void insert(Category category);

    @Update("update category set label = #{label},`rank` = #{rank} where id = #{id}")
    void update(Category category);
}
